﻿<%@ Page Title="Purchases Order" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="CreatePO.aspx.cs" Inherits="VSM.CreatePO" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function isNumberKey(sender, evt) {
            var txt = sender.value;
            var dotcontainer = txt.split('.');
            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57))
                return false;
            return true;
        }

        function OpenItemPopup() {
            var url = "../../ItemPopup.aspx?itmgrp=104"
            Main.openCustomDialog(url, 600, 610, "Accessories - Item Master Data");
        }

        function OpenBP() {
            var url = "../../BPPopup.aspx?CardType=S";
            Main.openCustomDialog(url, 600, 610, "Business Partner List");
        }

        function OpenDocList(docktype) {
            var url = "../../DocumentList.aspx?DocType=" + docktype
            Main.openCustomDialog(url, 800, 610, "Purchase Order List");
        }

        function OpenFCPO(docEntry, poDate, status) {
            var url = "ForecastsPO.aspx?DocEntry=" + docEntry
            url += "&PODate=" + poDate
            url += "&Status=" + status
            Main.openCustomDialog(url, 800, 610, "Forecasts Purchase Order");
        }

        function OpenAvailablePopup(item, onhand, dbType) {
            var url = "../../Available2PromisePopup.aspx?ItemCode=" + item;
            url += "&OnHand=" + onhand
            url += "&dbType=" + dbType

            Main.openCustomDialog(url, 600, 610, "VSM Planning");
        }

        function OpenMain() {
            var docentry = $("#<%= txtPONo.ClientID %>").val();
            var dimensions = 'directories=no,titlebar=yes,toolbar=no,location=1,status=yes,menubar=no,scrollbars=yes,resizable=yes,height=620 ,width= 900 ';
            if (navigator.appName != "Microsoft Internet Explorer") {
                window.opener = self;
            }
            else {
                window.opener = true;
            }

            window.open('', '_self');
            var newWindow = window.open('../Printing/FormPrinting.aspx?DocEntry=' + docentry + '&DocType=22', '_blank', dimensions);
            if (isIE() == 8) {
                newWindow.location.href = '../Printing/FormPrinting.aspx?DocEntry=' + docentry + '&DocType=22'
            }
            window.moveTo(0, 0);
            window.resizeTo(screen.width, screen.height - 100);
        }
        function isIE() {
            var myNav = navigator.userAgent.toLowerCase();
            return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
        }

    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server">
            <ContentTemplate>
                <asp:HiddenField ID="hdnIsUpdate" runat="server" />
                <asp:HiddenField ID="hdnStatus" runat="server" />
                <asp:HiddenField ID="hdnIsCreatedSO" runat="server" />
                <h2>
                    &nbsp;<asp:Label ID="lblTitle" runat="server" Text="Purchase Order"></asp:Label>
                </h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%" style="background-color: #D1D4D8; font-weight: bold;">
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">PO No.:</td>
                            <td>
                                <asp:TextBox ID="txtPONo" runat="server" BackColor="#E6E6E6" ReadOnly="True" 
                                    Width="100px"></asp:TextBox>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 100px;">Status:</td>
                            <td align="left">
                                <asp:Label ID="lblStatus" runat="server" Text="Open"></asp:Label>
                            </td>
                            <td align="right" >
                                <asp:Button ID="btnNew" runat="server" onclick="btnNew_Click" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Text="New" Width="50px" />
                                <asp:Button ID="btnDocList" runat="server" OnClientClick="OpenDocList('22'); return false;" 
                                    
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Text="List" Width="50px" />
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 150px;">Posting Date:</td>
                            <td style="width: 250px">
                                <asp:TextBox ID="txtPostingDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtPostingDate_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" PopupButtonID="imgPostingDate" TargetControlID="txtPostingDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgPostingDate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <asp:Label ID="lblPosDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">PO Type:</td>
                            <td colspan="2">
                                <asp:DropDownList ID="ddlPOType" runat="server">
                                    <asp:ListItem Value="0">mO</asp:ListItem>
                                    <asp:ListItem Value="1">eO</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Delivery Date:</td>
                            <td valign="top">
                                <asp:TextBox ID="txtDelDate" runat="server" Width="100px"></asp:TextBox>
                                <asp:ImageButton ID="imgDeldate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtDelDate"
                                    PopupButtonID="imgDeldate" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <asp:Label ID="lblDelDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Approve 
                                Status:</td>
                            <td colspan="2">

                                <asp:DropDownList ID="ddlAppStatus" runat="server" Enabled="False">
                                    <asp:ListItem Value="0">New</asp:ListItem>
                                    <asp:ListItem Value="1">Approved</asp:ListItem>
                                    <asp:ListItem Value="2">Rejected</asp:ListItem>
                                </asp:DropDownList>

                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Doc. Date:
                            </td>
                            <td colspan="4">
                                <asp:TextBox ID="txtPODate" runat="server" AutoPostBack="True" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM/yyyy" 
                                    PopupButtonID="imgPODate" TargetControlID="txtPODate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgPODate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />                            
                                <asp:Label ID="lblDocDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                        </tr>
                    </table>
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <tr>
                            <td class="FormLineItemAlt" valign="middle" style="width: 150px">
                                <asp:Label ID="lblVendor" runat="server" Text="Vendor:"></asp:Label>
                            </td>
                            <td class="FormLineItemAlt" colspan="3">
                                <asp:TextBox ID="txtVendorCode" runat="server" ReadOnly="True" style="width: 13%;" BackColor="#E6E6E6"></asp:TextBox>
                                <asp:TextBox ID="txtVendorName" runat="server"  style="width: 35%;" 
                                    BackColor="#E6E6E6" ReadOnly="True"></asp:TextBox>
                                <asp:Button ID="btnSelectVendor" runat="server" OnClientClick="OpenBP(); return false;"
                                    Text="..." 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; font-weight: bold" 
                                    Width="22px" />
                                <asp:Label ID="lblCustomerRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" valign="middle">
                                <asp:Label ID="lblConPersonName" Width="98%" Text="Contact Person:" runat="server"></asp:Label> 
                            </td>
                            <td class="FormLineItem" colspan="3">
                                <asp:TextBox ID="txtConpersonName" runat="server" style="width: 50%;"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" valign="middle" colspan="4">
                                <asp:Button ID="btnAddItems" runat="server" Text="Add vehicle"
                                    
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Width="85px" onclick="btnAddItems_Click" />
                                <asp:Button ID="btnAddAccessories" runat="server" OnClientClick="OpenItemPopup();return false;" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Text="Add accessories" Width="110px" />
                                <asp:FileUpload ID="FileUploadControl" runat="server" />
                                <asp:Button ID="btnImport" runat="server" onclick="btnImport_Click" text="Import" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" Width="60px" />
                                <asp:Button ID="btnForecast" runat="server" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Text="Forecast PO" Width="90px" onclick="btnForecast_Click" />
                            </td>
                        </tr>
                    </table>
                    <hr />
                    <div style="width: 100%">
                        <asp:GridView ID="grvPO" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" OnRowCreated="grvPO_RowCreated" CellSpacing="2" HeaderStyle-VerticalAlign="Middle"
                            HeaderStyle-HorizontalAlign="Center" AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" 
                            PageSize="20" OnRowDataBound="grvSearchResult_RowDataBound">
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
                                <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ItemStyle-Width="70px" />
                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" TabIndex="-1" OnClick="lnkDelete_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Model">
                                    <ItemStyle HorizontalAlign="Center" Width="120px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlModel" AutoPostBack="true" onselectedindexchanged="ddlModel_SelectedIndexChanged" 
                                            style="width: 98%;" runat="server">
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Product">
                                    <ItemStyle HorizontalAlign="Center" Width="120px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlProduct" AutoPostBack="true" onselectedindexchanged="ddlProduct_SelectedIndexChanged" style="width: 98%;" runat="server">
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Color">
                                    <ItemStyle HorizontalAlign="Center" Width="180px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlColor" AutoPostBack="true" onselectedindexchanged="ddlColor_SelectedIndexChanged" style="width: 98%;" runat="server">
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Item Code" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemCode" runat="server" Text='<%# Bind("ItemCode") %>' ></asp:Label>
                                        <asp:HiddenField ID="hdnVatGroup" runat="server" Value='<%# Bind("Taxcode") %>'></asp:HiddenField>
                                        <asp:HiddenField ID="hdnRate" runat="server" Value='<%# Bind("VatPrcnt") %>'></asp:HiddenField>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Item Name">
                                    <ItemStyle HorizontalAlign="left" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderItemName" runat="Server" Text="Item Name" />
                                        <asp:label ID="lblItemNameRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemName" runat="server" Text='<%# Bind("Dscription") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Option Code">
                                    <ItemStyle HorizontalAlign="Center" Width="50px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlOpt" AutoPostBack="true" onselectedindexchanged="ddlOpt_SelectedIndexChanged" style="width: 98%;" runat="server">
                                        </asp:DropDownList>
                                        <asp:HiddenField ID="hdnOpt" runat="server" Value='<%# Bind("U_OptionCode") %>'></asp:HiddenField>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Model" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblModel" runat="server" Text='<%# Bind("U_Model") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Product" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblProduct" runat="server" Text='<%# Bind("U_Product") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Color" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblColor" runat="server" Text='<%# Bind("U_Color") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Qty.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="40px" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderQty" runat="Server" Text="Qty." />
                                        <asp:label ID="lblQtyRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtOrderQuantity" runat="server" Width="97%" Text='<%# Bind("Quantity") %>'
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" OnTextChanged="txtOrderQuantity_OnTextChanged"/>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Unit Price">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtUnitPrice" Style="text-align: right" Width="97%" runat="server" Text='<%# Bind("PriceBefDi") %>' 
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txtUnitPrice_OnTextChanged"/>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="ETD" >
                                    <HeaderStyle VerticalAlign="Middle" Width="95px" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderETD" runat="Server" Text="ETD" />
                                        <asp:label ID="lblHeaderETDRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtETD" style="Width: 75%;" runat="server" Text='<%# Bind("U_ETD", "{0:dd/MM/yyyy}")%>' 
                                            OnTextChanged="txtETD_OnTextChanged" AutoPostBack="true"/>
                                        <asp:ImageButton ID="imgETD" runat="Server" AlternateText="Click to show calendar"
                                            ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                        <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtETD"
                                            PopupButtonID="imgETD" Format="dd/MM/yyyy">
                                        </cc1:CalendarExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="ETA" >
                                    <HeaderStyle VerticalAlign="Middle" Width="95px" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderETA" runat="Server" Text="ETA" />
                                        <asp:label ID="lblHeaderETARequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtETA" style="Width: 75%;" runat="server" Text='<%# Bind("U_ETA", "{0:dd/MM/yyyy}")%>' 
                                            OnTextChanged="txtETA_OnTextChanged" AutoPostBack="true"/>
                                        <asp:ImageButton ID="imgETA" runat="Server" AlternateText="Click to show calendar"
                                            ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                        <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtETA"
                                            PopupButtonID="imgETA" Format="dd/MM/yyyy">
                                        </cc1:CalendarExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Due Date" >
                                    <HeaderStyle VerticalAlign="Middle" Width="95px" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderDueDate" runat="Server" Text="Due Date" />
                                        <asp:label ID="lblHeaderDueDateRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtDueDate" style="Width: 75%;" runat="server" Text='<%# Bind("U_DueDate", "{0:dd/MM/yyyy}")%>' 
                                            OnTextChanged="txtDueDate_OnTextChanged" AutoPostBack="true"/>
                                        <asp:ImageButton ID="imgDueDate" runat="Server" AlternateText="Click to show calendar"
                                            ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                        <cc1:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtDueDate"
                                            PopupButtonID="imgDueDate" Format="dd/MM/yyyy">
                                        </cc1:CalendarExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Warehouse">
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlWhs" AutoPostBack="true" OnSelectedIndexChanged="ddlWhs_SelectedIndexChanged" Style="width: 98%;" runat="server" />
                                        <asp:HiddenField ID="hdnWhsCode" Value='<%# Bind("WhsCode") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Price After Disc" Visible="false">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblPrice" Style="text-align: right" runat="server" Text='<%# Bind("Price") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Line Total">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="120px" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtLineTotal" runat="server" Text='<%# Bind("LineTotal") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="VSM Plan">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" Width="50px" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lblVSMAvailable" OnClick="lblVSMAvailable_Click" runat="server" Text='<%# Bind("Available") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                Height="27px" VerticalAlign="Bottom" />
                            <EmptyDataTemplate>
                                <table class="GridInner" style="width: 100%; border-color: White; text-align: center;" border="1" rules="all" cellspacing="2" cellpadding="2">
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <th>
                                            <span>Action</span>
                                        </th>
                                        <th>
                                            <span>#</span>
                                        </th>
                                        <th>
                                            <span>Model</span>
                                        </th>
                                        <th>
                                            <span>Product</span>
                                        </th>
                                        <th>
                                            <span>Color</span>
                                        </th>
                                        <th>
                                            <span>Item Name</span>
                                        </th>
                                        <th>
                                            <span>Order Qty.</span>
                                        </th>
                                        <th>
                                            <span>Unit Price</span>
                                        </th>
                                        <th>
                                            <span>ETD</span>
                                        </th>
                                        <th>
                                            <span>ETA</span>
                                        </th>
                                        <th>
                                            <span>Due Date</span>
                                        </th>
                                        <th>
                                            <span>Warehouse</span>
                                        </th>
                                        <th>
                                            <span>Line Total</span>
                                        </th>
                                    </tr>
                                    <tr>
                                        <td colspan="13">
                                            <span>No Data</span>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </div>
                    <hr width="100%" />
                </div>
                <table width="100%" border="0">
                    <tr>
                        <td valign="top" style="width: 70%">
                            <table style="width: 100%;">
                                <tr>
                                    <td style="width: 10%;">
                                        <strong>Remarks :</strong>
                                    </td>
                                    <td style="width: 50%;">
                                        <asp:TextBox runat="server" style=" width: 98%;" ID="txtRemarks" Height="71px" TextMode="MultiLine"></asp:TextBox>
                                    </td>
                                    <td style="width: 10%;">
                                        <strong>Buyer:</strong>
                                    </td>
                                    <td style="width: 30%;">
                                        <asp:DropDownList ID="ddlBuyer" style=" width: 100%;" runat="server"></asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td style="width: 30%" align="right">
                            <div style="margin-right: 5px;">
                                <table border="0">
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td align="right">Sub Total:</td>
                                        <td style="width: 155px" align="right">
                                            <asp:Label ID="lblSubTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <td align="right">Tax Amount:</td>
                                        <td style="width: 155px" align="right">
                                            <asp:Label ID="lblTaxAmount" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td style="width: 150px" align="right">Grand Total:</td>
                                        <td align="right" style="width: 155px">
                                            <asp:Label ID="lblDocumentTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                        
                            <div style="margin-left: 5px; width: 99%;">
                                <hr />
                            </div>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 360px;">
                                        <asp:Button ID="btnSave" runat="server" Text="Save" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnSave_Click" 
                                            BorderStyle="Solid" Width="60px" />
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnCancel_Click" BorderStyle="Solid" Width="60px"
                                            OnClientClick="return confirm('Are you sure? After Canced, you cannot edit anythings in this Purchase Order.');" />
                                        <asp:Button ID="btnApprove" runat="server" Text="Approve" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnApprove_Click" 
                                            BorderStyle="Solid" Enabled="False" Width="60px" Visible="False" />
                                        <asp:Button ID="btnReject" runat="server" BorderStyle="Solid" Enabled="False" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="Reject" Width="60px" onclick="btnReject_Click" Visible="False" />
                                        <asp:Button ID="btnPrint" runat="server" BorderStyle="Solid" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="Print" Width="60px" onclick="btnPrint_Click" />
                                        <asp:Button ID="btnLastRecord" runat="server" BorderStyle="Solid" 
                                            OnClick="btnLastRecord_Click" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="&gt;&gt;" ToolTip="Last record" Width="40px" />
                                    </td>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                    <td align="right" style="width: 240px;">
                                        <asp:Button ID="btnCopyToGRPO" runat="server" Text="Copy to GRPO." Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" 
                                            onclick="btnCopyToGRPO_Click" Width="110px" />
                                        <asp:Button ID="btnCopyToAPInvoice" runat="server" Text="Copy to A/P Invoice" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" 
                                            onclick="btnCopyToAPInvoice_Click" Width="120px" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
